Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
How do I change react-navigation/drawer item "onPress" behavior?

I have a stack navigator nested inside a drawer navigator.

<HomeDrawerNavigator.Screen 
    name='Restaurants'
    component={RestaurantsStackNavigator}
/>
<HomeDrawerNavigator.Screen 
    name='Settings'
    component={SettingsNavigator}
/>

and

//RestaurantsStackNavigator
<RestaurantsNavigator.Screen 
    name='Menu'
    component={MenuScreen}

/>
<RestaurantsNavigator.Screen 
    name='MenuProductsDetail'
    component={MenuProductsDetailScreen}
/>

I want that when pressing the "Restaurants" button in the drawer to navigate to the first screen of the stack MenuScreen, even if the Restaurants item is already selected in the drawer.

Example: In the drawer, the Restaurants item is selected, and I'm in the MenuProductsDetailScreen. I want that when pressing the "Restaurants" button inside the drawer (that is already focused), to navigate to the MenuScreen.

I can use the StackActions.replace() function, but I don't know how to change the default behavior when pressing on a drawer item. Also any other workarounds are welcomed.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda